{include file="public/header" /}
<style type="text/css">
    .laydate-icon {
        background: transparent !important;
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <!-- Panel Other -->
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>提现列表</h5>
        </div>
        <div class="ibox-content">
            <!--搜索框开始-->           
            <div class="row">
                <div class="col-sm-12">
                    <div class="table-responsive">
                        <div class="col-sm-12">
                            <form method="post" action="{:url('index')}" class="form-inline">
                                <input placeholder="推广位" class="form-control" name="c#yx_pid-like" value="{$yx_pid|default=''}" type="text">
                                <input placeholder="用户昵称" class="form-control" name="c#nickname-like" value="{$nickname|default=''}" type="text">
                                <button class="btn btn-success btn-sm" type="submit" style="margin-bottom:0;margin-left:4px"><i class="fa fa-filter"></i> 筛选</button>
                                <a class="btn btn-primary btn-sm"  style="margin-bottom:0" href="{:url('index')}"><i class="fa fa-filter"></i> 重置</a>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
            <!--搜索框结束-->
            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="table table-bordered table-hover">
                        <thead>
                            <tr class="long-tr">
                                <th>推广位</th>
                                <th>微信名</th>
                                <th>类型</th>
                                <th>账户余额</th>
                                <th>申请金额</th>
                                <th>创建时间</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody id="list-content">
                            {foreach $list as $vo}
                                <tr class="long-td">
                                    <td>{$vo["yx_pid"]}</td>
                                    <td>{$vo.nickname}</td>
                                    <td>{:getEnumString(config('enum.customerCurrentLevel'), $vo.current_level)}</td>
                                    <td>{$vo.history_profit}</td>
                                    <td>{$vo.money}</td>
                                    <td>{$vo.create_time}</td>
                                    <td>

                                        {if $vo.status == 0}
                                        <a href="javascript:;" onclick="verifySuccess('{$vo.id}')" class="btn btn-info btn-xs" type="button">
                                            <i class="fa fa-check"></i> 审核通过</a>&nbsp;&nbsp;
                                        {/if}
                                        <a href="{:url('customer/edit', ['id'=>$vo.customer_id])}" class="btn btn-primary btn-xs">
                                            <i class="fa fa-info-circle"></i> 查看会员详情</a>
                                    </td>
                                </tr>
                            {/foreach}
                        </tbody>
                    </table>
                    <div id="laypage">
                        {$list->render()|raw}
                    </div>
                </div>
            </div>
            <!-- End Example Pagination -->
        </div>
    </div>
</div>
<!-- End Panel Other -->
</div>
{include file="public/footer" /}

<script type="text/javascript">
layui.use(['laypage', 'layer'], function(){
  var laypage = layui.laypage
  ,layer = layui.layer;

  //完整功能
  laypage.render({
    elem: 'laypage'
    ,count: '{$list->total()}' // 总数据条数
    ,curr: '{$list->currentPage()}' // 当前第几页
    ,limit: '{$list->listRows()}'   // 每页显示条数
    ,layout: ['count', 'prev', 'page', 'next', 'refresh', 'skip']
    ,jump: function(obj, first){
      //首次不执行
      if(!first){
            $("#searchForm").attr('action', '{:url("index")}?page='+obj.curr);
          $("#searchForm").submit();
      }
    }
  });
});

function verifySuccess(id) {
    layer.confirm('确认要审核通过吗？', {icon: 3}, function(index){
        $.ajax({
            url: "{:url('verifySuccess')}",
            type: "post",
            data: {
                withdrawId: id
            },
            dataType: "json",
            beforeSend:function() {
                // 显示loading
                index2 = layer.load(0, {
                    shade: [0.3,'#fff']
                });
            },
            success:function(data) {

                if (data['code'] != 1) {
                    layer.msg(data.msg,{icon:2,time:1000,shade: 0.1,}, function(index){
                        layer.close(index)
                    });
                    return false;
                }

                layer.msg(data.msg, {icon: 1,time:1000,shade:0.1}, function(index) {
                    window.location.reload()
                });
            },
            complete:function() {
                // 隐藏loading
                layer.close(index2);
            }
        });
    });
}
</script>

</body>
</html>